// .txt

beginzonescript;

variables;

short crime_tolerance = 5;
short last_abil;
short i;

body;

beginstate INIT_STATE;

	set_name(8,"Tima");
	if (gf(48,8) > 0)
		erase_char(8);
	if (gf(48,7) > 0)
		erase_char(8);
		
	set_name(13,"Cyprien");
	set_boss_level(13,1);
	
	set_name(14,"Guardian Genzlen");
	set_boss_level(14,1);
	

	add_range_to_group(36,41,1);
	set_name(41,"Rampaging Fyora");
	set_boss_level(41,2);
	set_attack_bonus(41,5);
	
	set_level(42,22);
	set_level(43,22);
	set_level(44,22);
	
	if (gf(100,11) > 0) {
		print_str_color("Word of your infamy has gotten here before you. You are forever marked",3);
		print_str_color("  as a foe of the Shapers.",3);
		sf(48,6,1);
		}
	if (get_sdf(48,6) > 0) {
		make_zone_hostile();
		}
		else {
			print_str_color("This is a friendly fort. You are able to rest.",2);
			revive_party();
			}	

	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	// clear zone?
	if ((zone_clear(ME) == FALSE) && (get_flag(48,4) > 0) && (get_flag(48,5) > 0)) {
		clear_zone(ME);	
		}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(48,6) == 0)) {
		make_zone_hostile();
		set_flag(48,6,1);
		}

	 if (gf(48,6) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Time to clean up.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Another wasted day.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Good. Not a Shaper.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Why are you here?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Need more fyoras.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"More at the east gate.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"We're due for a raid.");

		}
	
	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
	if ((gf(48,6) == 0) && (gf(48,12) == 0) && (char_ok(53)) && (char_ok(54)) && (char_ok(55))) {
		sf(48,12,1);
		begin_talk_mode(8);
		}
break;

beginstate 11;
	set_terrain_string_range("The sign says - Shaping Hall.",3);
break;

beginstate 12;
	set_terrain_string_range("The sign says - Servile Quarters.",3);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
